package no.sachmuld.methodcombination.examples.performance.annotation;

import no.sachmuld.methodcombination.api.MethodInvocation;
import no.sachmuld.methodcombination.examples.performance.FooBehaviour;
import no.sachmuld.methodcombination.examples.performance.Step;

/**
 *
 */
public class FooX extends Foo {

    public FooX() {
        with(new FooBehaviour() {

            @Override
            public void aroundBar(int i, MethodInvocation<Void> methodInvocation) {
                trace.add(Step.AROUND_X_BEGIN);
                methodInvocation.proceed();
                trace.add(Step.AROUND_X_END);
            }

            @Override
            public void beforeBar(int i) {
                trace.add(Step.BEFORE_X);
            }

            @Override
            public void bar(int i, MethodInvocation<Void> methodInvocation) {
                trace.add(Step.PRIMARY_X_BEGIN);
                methodInvocation.proceed();
                trace.add(Step.PRIMARY_X_END);
            }

            @Override
            public void afterBar(int i) {
                trace.add(Step.AFTER_X);
            }

        });
    }
}

